package org.jeecg.trace.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.trace.entity.MesPackItem;
import org.jeecg.trace.mapper.MesPackItemMapper;
import org.jeecg.trace.service.IMesPackItemService;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 包装子表
 * @Author: shaolong
 * @Date: 2022-11-16
 * @Version: V1.0
 */
@Service
public class MesPackItemServiceImpl extends ServiceImpl<MesPackItemMapper, MesPackItem> implements IMesPackItemService {

	@Autowired
	private MesPackItemMapper mesPackItemMapper;

	@Override
	public List<MesPackItem> selectByMainId(String mainId) {
		return mesPackItemMapper.selectByMainId(mainId);
	}

	@Override
	public Result<String> edit(MesPackItem mesPackItem) {
		LambdaUpdateWrapper<MesPackItem> eq = new LambdaUpdateWrapper<MesPackItem>();
		//eq.eq(MesPackItem::getRecId, qisMatdetailCfg.getRecId());
		boolean update = update(mesPackItem, eq);
		return update ? Result.ok("修改成功!") : Result.error("修改失败!");
	}

	@Override
	public IPage<MesPackItem> pageList(Page<MesPackItem> page, MesPackItem mesPackItem) {
		return mesPackItemMapper.pageList(page,mesPackItem);
	}
}
